﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZhaJinHua.Data;
using ZhaJinHua.Mvc.Web.Models;

namespace ZhaJinHua.Mvc.Web.Controllers
{
    public class GameController : Controller
    {
        // id : groupId
        public ActionResult Index(int id)
        {
            var model = new GameModel();
            var room = RoomService.Instance.GetRoom(id);
            model.Group = new GroupModel() {Id = room.GroupInfo.Id};
            model.GameStatus = room.CurrentGame.Status == GameStatus.InProgress ? "正在进行" : "暂停";
            model.Users = room.GroupInfo.Users.Select(x => new UserModel {RealName = x.RealName}).ToList();
            return View(model);
        }
    }
}